package com.lianjia.sh.se.kafka.client;

import com.alibaba.fastjson.JSONObject;
import com.lianjia.sh.se.kafka.client.annotion.KafkaListener;
import com.lianjia.sh.se.kafka.client.model.Person;
import org.springframework.stereotype.Component;

/**
 * Created by yangsp1 on 16/7/28.
 */
@Component
@KafkaListener(topic = "my-topic",bootstrapServers = "10.8.1.160:19092,10.8.1.93:19092")
public class MyKafkaListener extends AbstractKafkaListener {
    @Override
    public void onMessage(String value) {
        Person person = JSONObject.parseObject(value, Person.class);
        System.out.println("person.name =" + person.getName());
        System.out.println(value);
    }
}
